/*
 *  Copyright 2020-2025 the original author or authors.
 *  You cannot use this file unless authorized by the author.
 */

package org.ipig.computing.spark.conf;

import lombok.Data;
import org.ipig.commons.conf.ConfService;
import org.ipig.commons.helper.GsonHelper;
import org.ipig.computing.constant.context.SparkContext;

import java.io.Serializable;

/**
 * Application Conf
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @since 1.0
 */
@Data
public class ApplicationConf implements ConfService, Serializable, Comparable<ApplicationConf> {
    //the application name
    private String appName = "";
    //启动类所在的包
    private String appResource = "";
    //应用依赖配置
    private String appLibDir = "";
    //应用依赖包
    private String appConfDir = "";
    //the deploy mode for the application
    private String appDeployMode = SparkContext.DeployMode.CLUSTER.code;
    //启动类
    private String mainClass = "";
    //启动类所需要的参数
    private String mainArg = "";
    //create time
    private String createTime = "";

    public static ApplicationConf toObject(String json) {
        return GsonHelper.fromJson(json, ApplicationConf.class);
    }

    public String toJson() {
        return GsonHelper.toJson(this, this.getClass());
    }

    @Override
    public int compareTo(ApplicationConf o) {
        return 0;
    }
}

